package com.zhy.baselibrary.api;

import android.annotation.SuppressLint;

import com.zhy.baselibrary.utils.Klog;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okio.BufferedSource;


public class HttpLoggingInterceptor implements Interceptor {
    public static final String TAG = "HttpLogging";

    @SuppressLint("DefaultLocale")
    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request = chain.request();
        Klog.Companion.d("-------请求url------"+request.url());
        Response response = chain.proceed(request);
        BufferedSource source = response.body().source();
        source.request(Long.MAX_VALUE);
        Klog.Companion.d("-------返回结果Url------"+response.request().url());
        return response;
    }
}
